type action = Bytecode | Compile

let _ =
	let action = if Array.length Sys.argv > 1 then
		List.assoc Sys.argv.(1) [ ("-b", Bytecode); ("-c", Compile)]
	else Compile in
	let lexbuf = Lexing.from_channel stdin in
	let program = Parser.program Scanner.token lexbuf in
	match action with
  	| Bytecode -> let listing =
		Bytecode.string_of_prog (Compile.translate program)
		in print_endline listing
	| Compile -> ignore(Execute.execute_prog (Compile.translate program))
